package MAP_study;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class Map_study2 {
    public static void main(String[] args) {
        Map<String,Integer> map = new HashMap<>();
        map.put("a",11);
        map.put("b",12);
        map.put("c",13);
        Set<String>  set  = map.keySet();
        //1.用Set获取Map中的每一个key
        Iterator<String> it = set.iterator();
        //2.用迭代器遍历set集合
        while(it.hasNext())
        {
            //用map里的get方法获取value
            String key =it.next();
            System.out.println(key+"="+map.get(key));
        }
    }
}
